<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <meta name ="keywords" content="{{$metakeyword}}">
    <meta name="description" content="{{$metadesp}}">
    <title>{{$data['member']['nickname']}}的直播房间</title>
    <link rel="stylesheet" href="/css/layout.css">
    <link rel="stylesheet" href="/css/lay_icon.css">
    <link rel="stylesheet" href="/css/index.css">
    <link rel="stylesheet" href="/css/animtion/animate.min.css">
    <script src="/js/jquery-3.1.1.js"></script>
    <script src="/js/layer/1.9.3/layer.js"></script>
    <script src="/js/jquery.transit.js"></script>
    <script src="/js/gift.js"></script>
    <link href="/video.js/css/video-js.min.css" rel="stylesheet" type="text/css">
    <script src="/video.js/js/video.min.js"></script>
</head>
<script>
    var room = "{{$data['num']}}";
    var uid  = "{{!empty($user['ecuid'])?$user['ecuid']:0}}";
    var username = "{{!empty($user['nickname'])?$user['nickname']:0}}";
    var upath = "{{!empty($user['bigpic'])?$user['bigpic']:0}}";
    var isAdmin = "{{!empty($user['isAdmin'])?$user['isAdmin']:0}}";
    var isZhubo = "{{!empty($user['isZhubo'])?$user['isZhubo']:0}}"
    var client = 'normal1';
    var isLogin = "{{session('loginId')}}";
</script>
<body>
<div class="header">
    <div class="logo">
        <a href="">MINI秀 <b>bete1.0</b></a>
    </div>
    <div class="l_rt">
        @if($user['islogin']==1)
            <div class="login_user">
                <div class="user_info">
                    <div class="user_icon">
                        <img src="{{$user['bigpic']}}" alt="">
                    </div>
                    <div class="user_name"><a href="/profile">{{$user['username']}}</a></div>
                </div>
                <a href="" style="font-size: 14px">退出</a>
            </div>
        @else
            <a href="javascript:;" onclick="login()">登录</a>
            <a href="javascript:;" onclick="register()">注册</a>
        @endif
    </div>
</div>
<div class="content">
    <div class="setbar">
        <ul>
            <li><a href="/"><i class="home"></i><span>首页</span></a></li>
            <li><a href="/cate/index"><i class="cate"></i><span>分类</span></a></li>
            <li><a href=""><i class="gc"></i><span>广场</span></a></li>
            <li><a href=""><i class="fa"></i><span>Fans</span></a></li>
            <li><i class="hide"></i><span>隐藏</span></li>
        </ul>
    </div>
    <div class="con" style="margin-left: 5px;">
        <div class="con_l">
         <div class="showinfo">
             <div class="face">
                 <img src="{{$data['member']['bigpic']}}" alt="">
             </div>
             <div class="info">
                 <div class="uname">{{$data['title']}}</div>
                 <div class="utype">
                     <span>主播：{{$data['member']['nickname']}}</span> <span><i class="icon_16 level"></i>{{$data['member']['level_zhubo']}}</span> <span>类别:{{$data['cate']['catename']}}</span>
                 </div>
                  <div class="u_details">
                       <span><i class="icon_16 hot"></i></span>
                       <span><i class="icon_16 attact"></i>{{$data['attentionnum']}}</span>
                       <span><i class="icon_16 online"></i>{{$data['online_num']}}</span>
                  </div>
              </div>
              <div class="live">
                   <div class="attach">@if(isset($user['isAttent']) && $user['isAttent']==1)<span class="e_attach" onclick="attent(0)">已关注</span>@else<span class="attach1" onclick="attent(1)">关注</span>@endif<span>{{$data['attentionnum']}}</span></div>
                   <div class="jb"><i class="icon_20 jb_icon"></i>举报</div>
              </div>
         </div>
         <div class="show_paly">
              <div class="video">
                  @if ($data['isLive']==1)
                  <video id="my-video" class="video-js vjs-default-skin vjs-big-play-centered"
                         poster="videojs/eguidlogo.png" style="width: 100%!important; height: 400px;"
                  >
                      <!--
                          <soussrce src="../output.mp4" type='video/mp4'>  mp4格式
                          <source src='rtmp://127.0.0.1/hls/test' type='rtmp/flv'/> rtmp格式
                          <source src='http://127.0.0.1/hls/test.m3u8' type='application/x-mpegURL'/>  m3u8格式
                          <source src='http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8' type='application/x-mpegURL'/> m3u8格式，可用
                      -->
                      <source src='rtmp://live.hkstv.hk.lxdns.com/live/hks' type='rtmp/flv'/>
                  </video>
                  <div class="logo—suiyin">{{date('Y-m-d',time())}} {{$data['num']}}</div>
                      @else
                      <div class="no_live">
                           <h3>主播还在赶来的路上</h3>
                      </div>
                  @endif
              </div>
              <div class="funlist">
                   <div class="f_top">
                        <div class="f_top_l">
                             <p>在线时长领取礼物</p>
                             @if($user['islogin']!=0)
                             <span onclick="showLw()"><i class="icon_20 gift_wait"></i> 等待</span>
                             <div class="lw_collect_box">
                                  <div class="close_box" onclick="closeLw()">X</div>
                                  <div class="lw_collect_title">礼物盒子</div>
                                  <div class="lw_collect_con">
                                      @for($i=1;$i<6;$i++)
                                       <div class="lw_item">
                                            <div class="lw_item_icon @if($recivegift['giftnow']==$i) active @endif"></div>
                                            <p @if($recivegift['giftnow']==$i && $recivegift['gift_'.$recivegift['giftnow']]==1) onclick="getgift(this)" style="cursor: pointer;" @endif> @if($recivegift['gift_'.$i]==1) 已领取 @else @if($recivegift['giftnow']==$i && $recivegift['gift_'.$recivegift['giftnow']]==1) 待领取 @elseif($recivegift['giftnow']==$i) 计时中 <b class="lw_time" time="{{$recivegift['remaintime']}}">0:00</b> @else 等待中 @endif @endif</p>
                                       </div>
                                      @endfor
                                  </div>
                             </div>
                             @else
                                 <span style="color:#00a2d4;">登录领礼物</span>
                             @endif
                        </div>
                        <div class="f_top_r">
                             <p>常用礼物: <i style="font-size: 12px; color: #999;">(点击下面的图标送出礼物给主播)</i> </p>
                             @foreach( $gift as $v )
                             <span onclick="sendgift(this)">
                                 <img src="/{{$v['giftIcon']}}" gid="{{$v['id']}}" gname="{{$v['giftname']}}" title="{{$v['needcoin']}}/M币" alt="">
                             </span>
                             @endforeach
                            <div class="my">
                                @if(isset($user['m']))
                                <span ><i class="icon_20 m"></i> M币 : <strong id="m">{{$user['m']}}</strong> <a href="" style="font-size: 12px;">(怎么获得M币)</a></span>
                                @endif
                            </div>
                        </div>
                   </div>
              </div>
         </div>
        </div>
        <div class="con_r">
             <div class="bang">
                  <div class="bang_item">
                       <span class="active">贡献周榜</span>
                       <span>贵族</span>
                       <span>粉丝团</span>
                  </div>
                  <div class="bang_con_1" style="display: block;">
                       <div class="bang_tips_i">点击右侧查看总榜 <a href="">查看总榜</a></div>
                       <div class="bangtop">
                           @if (empty($weekdata))
                           <div class="nodata">
                                <div class="nodata_icon"></div>
                                <p>抢位就是你的了</p>
                           </div>
                           @else
                               @foreach($weekdata as $k=>$v)
                                   @if($k==1)
                                   <div class="top"><div class="min_top_icon"><img src="{{$v['member']['bigpic']}}" alt="" width="100%" height="100%"></div><p>{{$v['member']['nickname']}}</p></div>
                                   @else
                                       @if($v==0)
                                           <div class="top"><div class="min_top_icon"><img src="/images/xuwei.png" alt="" width="100%" height="100%"></div><p>虚位以待</p></div>
                                       @else
                                       <div class="top"><div class="min_top_icon"><img src="{{$v['member']['bigpic']}}" alt="" width="100%" height="100%"></div><p>{{$v['member']['nickname']}}</p></div>
                                       @endif
                                   @endif
                               @endforeach
                               <div class="top_list">
                                   @for ($i=4;$i<count($weekdata);$i++)
                                   <p><i>4</i>shepen <span class="t_up"></span></p>
                                   @endfor
                               </div>
                           @endif
                       </div>
                  </div>
                  <div class="bang_con_1">
                      <div class="bang_tips_i"></div>
                  </div>
                  <div class="bang_con_1">
                      <div class="bang_tips_i"></div>
                      <div class="bangtop">
                          @if (empty($fansToplist))
                              <div class="nodata">
                                  <div class="nodata_icon"></div>
                                  <p>抢位就是你的了</p>
                              </div>
                          @else
                              @foreach($fansToplist as $k=>$v)
                                  @if($k==1)
                                      <div class="top"><div class="min_top_icon"><img src="{{$v['member']['bigpic']}}" alt="" width="100%" height="100%"></div><p>{{$v['member']['nickname']}}</p></div>
                                  @else
                                      @if($v==0)
                                          <div class="top"><div class="min_top_icon"><img src="/images/xuwei.png" alt="" width="100%" height="100%"></div><p>虚位以待</p></div>
                                      @else
                                          <div class="top"><div class="min_top_icon"><img src="{{$v['member']['bigpic']}}" alt="" width="100%" height="100%"></div><p>{{$v['member']['nickname']}}</p></div>
                                      @endif
                                  @endif
                              @endforeach
                          @endif
                      </div>
                  </div>
             </div>
             <div class="dmbox" id="danmbox">
                  <div class="room_tips">欢迎来到 <span style="color:#00a2d4;">{{$data['member']['nickname']}}</span> 的房间，喜欢就点下关注，本房间提倡文明直播，抵制色情，反动等内容，如有发现立即封号</div>
                 <!--<div class="gift_show" id="gift_0" style="top: 30px;">-->
                     <!--<div class="gift_inner">-->
                      <!--<div class="gift_face">-->
                          <!--<img src="./images/5500581474415.jpg" alt="">-->
                      <!--</div>-->
                      <!--<div class="gift_info">-->
                           <!--<p class="u">婷婷爱慌慌</p>-->
                           <!--<p class="gift_desc">对主播送出了s60飞机</p>-->
                           <!--<div class="gift_img">-->
                               <!--<img src="./images/gift/hj.jpg" alt="">-->
                           <!--</div>-->
                      <!--</div>-->
                     <!--</div>-->
                     <!--<div class="lianji" id="lianji_0">-->
                          <!--<i></i> <span>1</span>-->
                     <!--</div>-->
                 <!--</div>-->
                 <!--<div class="gift_show" id="gift_1" style="top:100px">-->
                     <!--<div class="gift_inner">-->
                         <!--<div class="gift_face">-->
                             <!--<img src="./images/2014053016293779611.png" alt="">-->
                         <!--</div>-->
                         <!--<div class="gift_info">-->
                             <!--<p class="u">慌慌爱婷婷</p>-->
                             <!--<p class="gift_desc">对主播送出了60飞机</p>-->
                             <!--<div class="gift_img">-->
                                 <!--<img src="./images/gift/hj.jpg" alt="">-->
                             <!--</div>-->
                         <!--</div>-->
                     <!--</div>-->
                     <!--<div class="lianji" id="lianji_1">-->
                         <!--<i></i> <span>1</span>-->
                     <!--</div>-->
                 <!--</div>-->
             </div>
             <div class="send">
                  <div class="message">
                       <i></i>
                       <p></p>
                  </div>
                  <div class="send_text"><span class="fs"><i>未拥有</i></span><input type="text" id="mess" @if($user['islogin']) placeholder="说点什么吧" @else placeholder="请登录后在发弹幕" @endif><input
                          type="submit" value="发送" id="sub" @if(!$user['islogin']) style="background: #ccc" @endif></div>
             </div>
        </div>
    </div>
</div>
<div class="footer"></div>
{{--<div class="dialg animated bounceIn">--}}
     {{--<div class="dialg_title"> 房管特权 </div>--}}
     {{--<div class="dialg_cont">--}}
         {{--<div class="confirmtips">--}}
             {{--你确定要禁止其用户在本房间发言?<p>禁言后该用户将无法在本房间发表任何言论</p>--}}
         {{--</div>--}}
         {{--<div class="dialg_btn">--}}
             {{--<a href="JavaScript:;">确定</a>--}}
             {{--<a href="javascript:;">取消</a>--}}
         {{--</div>--}}
     {{--</div>--}}
{{--</div>--}}
</body>
</html>

<script type="text/javascript" src="/js/roomwebsocket.js"></script>
<script type="text/javascript" src="/js/roomCotroller.js"></script>
<script>
    var isLive = {{$data['isLive']}};
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    /**
     * 判断快速点击
     * */
    function isDouClick() {
       var clickStamp = new Date().getTime(); // 点击的时间戳
       lastCLickTime = localStorage.getItem('clickTimes');
       localStorage.setItem('clickTimes',clickStamp);
       if (clickStamp-lastCLickTime<500){
             return true;
       }else{
             return false;
       }
    }

    /**
     * 送礼物
     */
    function sendgift(_this) {
         _thisImage = _this.getElementsByTagName('img')[0];
         var gname = _thisImage.getAttribute('gname');
         var gpath = _thisImage.src ;
         var gid = _thisImage.getAttribute('gid');

         //判断登录状态
         var isLogin = "{{session('loginId')}}";

         if (!isLogin) {
             layer.msg('你未登录,登录才能送礼',{icon:2});
             return
         }

         if (!isLive) {
             layer.msg('主播未开播，还不能送礼',{icon:2});
             return
         }
         data = {gname:gname,gift:gpath,uid:uid,gid:gid,username:username,upath:upath};
         data = {data:data,num:1,shownum:1,time:15};
         checkData = {gid:gid};
         $.ajax({
             type:"POST",
             url:'/live/sendgiftcheck',
             data:checkData,
             dataType:"json",
             success:function (res) {
                 if (res['code'] == 400) {
                     layer.msg(res['msg'],{icon:2});
                     return
                 }
                 gift.addgiftToQueue(data,true);
                 dmshowAnimation();
             }
         })
    }

    var player = videojs('my-video');
    player.play();
</script>